package com.wayhome.srpingbootmybatis.policy.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
@ApiModel("政策文件上传")
public class PolicyDocFileDTO {


    @ApiModelProperty(value = "主键ID")
    private Long id;

    @ApiModelProperty(value = "政策文件id")
    private Long policyDocId;

    @ApiModelProperty(value = "文件路径")
    private String filePath;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "有效标志")
    private String valiFlag;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "数据创建时间")
    private Date crteTime;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "数据更新时间")
    private Date updtTime;

    @ApiModelProperty(value = "创建人ID")
    private String crterId;

    @ApiModelProperty(value = "创建人姓名")
    private String crterName;

    @ApiModelProperty(value = "创建机构编号")
    private String crteOptinsNo;

    @ApiModelProperty(value = "经办人ID")
    private String opterId;

    @ApiModelProperty(value = "经办人姓名")
    private String opterName;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "经办时间")
    private Date optTime;

    @ApiModelProperty(value = "经办机构编号")
    private String optinsNo;

    //设置新增时的默认参数
    public void setDefaultInsertParam() {
        this.valiFlag = "1";
        //时间
        Date now = new Date();
        //创建时间
        this.crteTime = now;
        //更新时间
        this.updtTime = now;
        //经办时间
        this.optTime = now;

        String userAcct = "system";
        String userName = "系统";
        String optinNo = "S13000010001";
        //创建人
        this.crterId = userAcct;
        this.crterName = userName;
        this.crteOptinsNo = optinNo;
        //经办人
        this.opterId = userAcct;
        this.opterName = userName;
        this.optinsNo = optinNo;
    }

}

